home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
quikc21.zip
/
QWIKC21.H
< prev
next >
Wrap
Text File
|
1989-07-06
|
10KB
|
247 lines
/*===========================================================================*\
| QWIKC21.H ver 2.1, 07-06-89 |
| |
| Header file for quick, direct screen writing for C |
| Copyright (c)1988-1989 James H. LeMay, All rights reserved. |
| |
| Conversion to C by Jordan Gallagher/Wisdom Research |
| |
| For documentation on this file see QWIKC21.DOC and QWIKREF.DOC. |
| Only 45 bytes of global data are used. |
\*===========================================================================*/
#ifndef __TURBOC__
#define videomode (*(char far *)(0x449L+_z)) /* Mode: Mono=7,Color=0-3 */
#define videopage (*(char far *)(0x462L+_z)) /* Video page number */
#define egarows (*(char far *)(0x484L+_z)) /* Rows on screen (0-based) */
#define egainfo (*(char far *)(0x487L+_z)) /* EGA info. See QWIKREF.DOC */
#define egafontsize (*(int far *)(0x485L+_z)) /* Char cell height (1-based) */
#define crtcolumns (*(int far *)(0x44L+_z)) /* # of CRT columns (1-based) */
#else
#define videomode (*(char far *)0x449L) /* Video mode: Mono=7,Color=0-3 */
#define videopage (*(char far *)0x462L) /* Video page number */
#define egarows (*(char far *)0x484L) /* Rows on screen (0-based) */
#define egainfo (*(char far *)0x487L) /* EGA info. See QWIKREF.DOC */
#define egafontsize (*(int far *)0x485L) /* Char cell height (1-based) */
#define crtcolumns (*(int far *)0x44L) /* Num of CRT columns (1-based) */
#endif
extern unsigned char system_id, /* Equipment ID. See QWIKREF.DOC */
submodel_id, /* Equipment ID. See QWIKREF.DOC */
cpuid, /* Model number of Intel CPU */
qvideo_mode, /* Video mode detected by Qwik */
qvideo_page, /* Video page to which Qwik is writing */
maxpage, /* Maximum possible page */
cardsnow, /* Wait-for-retrace (snow) for video card */
have_ps2, /* Using some type of IBM PS/2 equip */
have_3270, /* Using IBM 3270 PC workstation hard/software */
ega_switches, /* EGA card and monitor setup */
active_disp_dev, /* Active Display Device */
active_disp_dev_3270, /* Active Display Device for IBM 3270 PC */
alt_disp_dev, /* Alternate Display Device */
herc_model, /* Model of Hercules card. */
inmultask, /* Set to 1 if setmultitask() called in
multitasking environment */
_z; /* workaround for MicroSoft QuickC 1.0 bug */
extern int page0seg; /* Segment for page 0 for video card/buffer */
extern int cardseg; /* Segment for page 0 for video card */
extern int alt_disp_dev_pcc; /* Alt Display Device for PC Convertible */
extern int scroll_attr; /* Attribute used to clear row in qeosln() */
typedef struct {
void far *vscrptr; /* Pointer to memory writes are done to */
unsigned veosofs; /* End Of String offset after Qwik writing */
unsigned vsize; /* Essentially size of CRT video buffer in bytes */
unsigned char vrows; /* Global variable of Rows/Ega rows (1-based!) */
unsigned char vcols; /* Global variable of CRT columns (1-based) */
char vsnow; /* Wait-for-retrace (snow) while Qwik writing */
} vscr_t;
extern vscr_t qscr;
#define crt_rows qscr.vrows
#define crt_cols qscr.vcols
#define qsnow qscr.vsnow
#define crt_size qscr.vsize
#define qeosofs qscr.veosofs
#define qscrofs *((unsigned *) (&qscr.vscrptr))
#define qscrseg *((unsigned *) (&qscr.vscrptr)+1)
#define qscrptr qscr.vscrptr
/* Constants assigned by IBM: */
enum modes {
no_display, /* 00 through 0C, FF */
mda_mono,
cga_color,
dcc3,
ega_color,
ega_mono,
pgc_color,
vga_mono,
vga_color,
dcc9,
dcc10,
mcga_mono,
mcga_color,
unknown = 255
};
/* Arbitrarily assigned constants: */
enum herc {
no_herc,
hgc_mono,
hgc_plus,
herc_incolor
};
enum cpu {
cpu8086,
cpu80186,
cpu80286,
cpu80386
};
/* These are the foreground text colors */
#if !defined(__COLORS)
#define __COLORS
enum COLORS {
BLACK,
BLUE,
GREEN,
CYAN,
RED,
MAGENTA,
BROWN,
LIGHTGRAY,
DARKGRAY,
LIGHTBLUE,
LIGHTGREEN,
LIGHTCYAN,
LIGHTRED,
LIGHTMAGENTA,
YELLOW,
WHITE
};
#endif
/* These are the background colors */
enum bgcolors {
BLACK_BG = 0x00,
BLUE_BG = 0x10,
GREEN_BG = 0x20,
CYAN_BG = 0x30,
RED_BG = 0x40,
MAGENTA_BG = 0x50,
BROWN_BG = 0x60,
LIGHTGRAY_BG = 0x70
};
#ifndef __VIDEO
enum txtmodes {
BW40,
C40,
BW80,
C80,
MONO = 7
};
#endif
#define BLINK 128 /* blink bit -- add to attribute */
#define SAMEATTR -1 /* supresses attribute changes to the screen */
/* The following are macros used in calling setcursor() and modcursor() */
#define cursor_on 0x0000 /* Turns cursor on with same shape */
#define cursor_off 0x2000 /* Turns cursor off with same shape */
#define cursor_blink 0x6000 /* Creates erratic blinking for many machines */
/* These cursor modes are set by qinit() as detected for the video card: */
extern int cursor_initial; /* Cursor detected at startup */
extern int cursor_underline; /* Standard underline cursor */
extern int cursor_halfblock; /* Usually used for Insert editing */
extern int cursor_block; /* For those who have to squint */
/* ----------- QINIT ----------- */
void qinit( void );
void qreinit( void );
/* ----------- QWRITES ----------- */
void qwrite( unsigned char row, unsigned char col, int attr,
char far *astr );
void qwritec( unsigned char row, unsigned char col, unsigned char cols,
int attr, char far *astr );
void qwriteeos( int attr, char far *astr );
/* ----------- QWRSUB ----------- */
void qwrite_sub( unsigned char row, unsigned char col, int attr, int length,
char far *astr );
void qwriteeos_sub( int attr, int length, char far *astr );
/* ----------- QFILLS ----------- */
void qfill( unsigned char row, unsigned char col, unsigned char rows,
unsigned char cols, int attr, char ch );
void qattr( unsigned char row, unsigned char col, unsigned char rows,
unsigned char cols, int attr );
void qfillc( unsigned char row, unsigned char col_l, unsigned char col_r,
unsigned char rows, unsigned char cols, int attr, char ch );
void qattrc( unsigned char row, unsigned char col_l, unsigned char col_r,
unsigned char rows, unsigned char cols, int attr );
void qfilleos( unsigned char rows, unsigned char cols, int attr, char ch );
void qattreos( unsigned char rows, unsigned char cols, int attr );
/* ----------- QSTORES ----------- */
void qstoretomem( unsigned char row, unsigned char col, unsigned char rows,
unsigned char cols, void far *dest );
void qstoretoscr( unsigned char row, unsigned char col, unsigned char rows,
unsigned char cols, void far *src );
void qscrtovscr( unsigned char row, unsigned char col, unsigned char rows,
unsigned char cols, unsigned char vrow, unsigned char vcol,
unsigned char vwidth, void far *vscrptr );
void qvscrtoscr( unsigned char row, unsigned char col, unsigned char rows,
unsigned char cols, unsigned char vrow, unsigned char vcol,
unsigned char vwidth, void far *vscrptr );
/* ----------- QSCROLLS -